<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.7.1.min.js"></script>
<script src="${pageContext.request.contextPath}/js/toastr/toastr.min.js"></script>
<link href="${pageContext.request.contextPath}/js/toastr/toastr.min.css" rel="stylesheet" />
<script type="text/javascript">
	$(document).ready(function(){
		$("#test").bind("click",function(){
			$.ajax({
				type:"POST",
				dataType:"json",
				url:"${pageContext.request.contextPath}/system/user/getUserById.do",
				data:{"userId":1},
				success:function(result){
				    if(result.rs){
                        top.toastr.success(result.data);
                    }else{
                        top.toastr.error("连接失败，请联系管理员！");
                    }
				}
			});
		});
	});

	var urlType = ["setDebug","setInfo","setError"];

	function doAjax(index){
        $.ajax({
            type:"POST",
            dataType:"json",
            url:"${pageContext.request.contextPath}/system/user/"+urlType[index]+".do",
            success:function(result){
                if(result.rs){
                    top.toastr.success(result.data);
                }else{
                    top.toastr.error("连接失败，请联系管理员！");
                }
            }
        });
	}

	function doClick(type) {
		switch (type){
			case "debug" :
                doAjax(0);
                break;
			case "info" :
			    doAjax(1);
                break;
			case "error" :
			    doAjax(2);
                break;
		}
    }

</script>
<br>
	<h2>测试小程序!</h2>
	<a id="test" href="javascript:void(0)" >test user</a></br>
	<a id="test1" href="javascript:void(0)" onclick="doClick('debug')">test debug</a></br>
	<a id="test2" href="javascript:void(0)" onclick="doClick('info')">test info</a></br>
	<a id="test3" href="javascript:void(0)" onclick="doClick('error')">test error</a></br>
</body>
</html>
